initial effort on pulling Agents into gems

Andrew Cantino 9 years ago
parent
commit
0bd46b524f

+ 3 - 1
Gemfile

@@ -23,6 +23,8 @@ def if_true(condition)
23 23
   end
24 24
 end
25 25
 
26
+gem 'rss_agent', path: 'agents/rss_agent'
27
+
26 28
 # Optional libraries.  To conserve RAM, comment out any that you don't need,
27 29
 # then run `bundle` and commit the updated Gemfile and Gemfile.lock.
28 30
 gem 'twilio-ruby', '~> 3.11.5'    # TwilioAgent
@@ -92,7 +94,6 @@ gem 'devise', '~> 3.5.4'
92 94
 gem 'em-http-request', '~> 1.1.2'
93 95
 gem 'faraday', '~> 0.9.0'
94 96
 gem 'faraday_middleware', github: 'lostisland/faraday_middleware', branch: 'master'  # '>= 0.10.1'
95
-gem 'feed-normalizer'
96 97
 gem 'font-awesome-sass', '~> 4.3.2'
97 98
 gem 'foreman', '~> 0.63.0'
98 99
 # geokit-rails doesn't work with geokit 1.8.X but it specifies ~> 1.5
@@ -102,6 +103,7 @@ gem 'geokit-rails', '~> 2.0.1'
102 103
 gem 'httparty', '~> 0.13'
103 104
 gem 'httmultiparty', '~> 0.3.16'
104 105
 gem 'jquery-rails', '~> 3.1.3'
106
+gem 'huginn_agent'
105 107
 gem 'json', '~> 1.8.1'
106 108
 gem 'jsonpath', '~> 0.5.6'
107 109
 gem 'kaminari', '~> 0.16.1'

+ 10 - 1
Gemfile.lock

@@ -59,6 +59,13 @@ GIT
59 59
       omniauth-oauth2 (~> 1.1)
60 60
 
61 61
 PATH
62
+  remote: agents/rss_agent
63
+  specs:
64
+    rss_agent (0.1)
65
+      feed-normalizer (~> 1.5.2)
66
+      huginn_agent
67
+
68
+PATH
62 69
   remote: vendor/gems/dotenv-2.0.1
63 70
   specs:
64 71
     dotenv (2.0.1)
@@ -281,6 +288,7 @@ GEM
281 288
     httparty (0.13.7)
282 289
       json (~> 1.8)
283 290
       multi_xml (>= 0.5.2)
291
+    huginn_agent (0.1)
284 292
     hypdf (1.0.10)
285 293
       httmultiparty (~> 0.3)
286 294
       httparty (~> 0.13)
@@ -614,7 +622,6 @@ DEPENDENCIES
614 622
   evernote_oauth
615 623
   faraday (~> 0.9.0)
616 624
   faraday_middleware!
617
-  feed-normalizer
618 625
   ffi (>= 1.9.4)
619 626
   font-awesome-sass (~> 4.3.2)
620 627
   forecast_io (~> 2.0.0)
@@ -629,6 +636,7 @@ DEPENDENCIES
629 636
   hipchat (~> 1.2.0)
630 637
   httmultiparty (~> 0.3.16)
631 638
   httparty (~> 0.13)
639
+  huginn_agent
632 640
   hypdf (~> 1.0.10)
633 641
   jquery-rails (~> 3.1.3)
634 642
   json (~> 1.8.1)
@@ -666,6 +674,7 @@ DEPENDENCIES
666 674
   rspec-collection_matchers (~> 1.1.0)
667 675
   rspec-html-matchers (~> 0.7)
668 676
   rspec-rails (~> 3.1)
677
+  rss_agent!
669 678
   rturk (~> 2.12.1)
670 679
   ruby-growl (~> 4.1.0)
671 680
   rufus-scheduler (~> 3.0.8)

+ 7 - 0
Rakefile

@@ -5,3 +5,10 @@
5 5
 require File.expand_path('../config/application', __FILE__)
6 6
 
7 7
 Huginn::Application.load_tasks
8
+
9
+task("spec").clear
10
+RSpec::Core::RakeTask.new(:spec) do |t|
11
+  t.pattern = ['spec/**/*_spec.rb', 'agents/**/spec/**/*_spec.rb']
12
+end
13
+
14
+task :default => :spec

+ 22 - 0
agents/rss_agent/LICENSE.txt

@@ -0,0 +1,22 @@
1
+Copyright (c) 2014 Andrew Cantino
2
+
3
+MIT License
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining
6
+a copy of this software and associated documentation files (the
7
+"Software"), to deal in the Software without restriction, including
8
+without limitation the rights to use, copy, modify, merge, publish,
9
+distribute, sublicense, and/or sell copies of the Software, and to
10
+permit persons to whom the Software is furnished to do so, subject to
11
+the following conditions:
12
+
13
+The above copyright notice and this permission notice shall be
14
+included in all copies or substantial portions of the Software.
15
+
16
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

app/models/agents/rss_agent.rb → agents/rss_agent/lib/huginn_agent/rss_agent.rb


+ 3 - 0
agents/rss_agent/lib/rss_agent.rb

@@ -0,0 +1,3 @@
1
+require 'huginn_agent'
2
+
3
+HuginnAgent.register 'huginn_agent/rss_agent'

+ 25 - 0
agents/rss_agent/rss_agent.gemspec

@@ -0,0 +1,25 @@
1
+# coding: utf-8
2
+lib = File.expand_path('../lib', __FILE__)
3
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+Gem::Specification.new do |spec|
6
+  spec.name          = "rss_agent"
7
+  spec.version       = '0.1'
8
+  spec.authors       = ["Andrew Cantino"]
9
+  spec.email         = ["https://github.com/cantino/huginn"]
10
+  spec.summary       = %q{The default Huginn RSSAgent for consuming RSS and Atom feeds.}
11
+  spec.homepage      = "https://github.com/cantino/huginn"
12
+  spec.license       = "MIT"
13
+
14
+  spec.files         = `git ls-files -z`.split("\x0")
15
+  spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+  spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
17
+  spec.require_paths = ["lib"]
18
+
19
+  spec.add_development_dependency "bundler", "~> 1.7"
20
+  spec.add_development_dependency "rake", "~> 10.0"
21
+  spec.add_development_dependency "rspec"
22
+  
23
+  spec.add_runtime_dependency "huginn_agent"
24
+  spec.add_runtime_dependency "feed-normalizer", "~> 1.5.2"
25
+end

spec/models/agents/rss_agent_spec.rb → agents/rss_agent/spec/rss_agent_spec.rb


+ 2 - 1
config/initializers/requires.rb

@@ -1 +1,2 @@
1
-require 'pp'
1
+require 'pp'
2
+HuginnAgent.require!